﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GRWL.BZSC.Common
{
    public class EventCommon
    {
        #region 委托更新其它窗体Treeview
        /// <summary>
        /// 更新Treeview控件委托类型
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="arg"></param>
        public delegate void UpdateTreeViewDlgt(object sender, EventArgs arg);

        #region 通用选项Treeview控件委托
        /// <summary>
        /// 通用选项操作回调事件
        /// </summary>
        public static event UpdateTreeViewDlgt OptionUdTVEvnt;
        /// <summary>
        /// 通用选项操作回调处理事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="arg"></param>
        public static void OnOptionUdTVEvnt(object sender, EventArgs arg)
        {
            if (OptionUdTVEvnt != null)
                OptionUdTVEvnt(sender, arg);
        }
        #endregion

        #region 物料Treeview控件委托
        /// <summary>
        /// 物资操作回调事件
        /// </summary>
        public static event UpdateTreeViewDlgt MaterialUdTVEvnt;
        /// <summary>
        /// 物资操作回调处理事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="arg"></param>
        public static void OnMaterialUdTVEvnt(object sender, EventArgs arg)
        {
            if (MaterialUdTVEvnt != null)
                MaterialUdTVEvnt(sender, arg);
        }
        #endregion

        #region 仓库Treeview控件委托
        /// <summary>
        /// 物资操作回调事件
        /// </summary>
        public static event UpdateTreeViewDlgt DepotUdTVEvnt;
        /// <summary>
        /// 物资操作回调处理事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="arg"></param>
        public static void OnDepotUdTVEvnt(object sender, EventArgs arg)
        {
            if (DepotUdTVEvnt != null)
                DepotUdTVEvnt(sender, arg);
        }
        #endregion

        #region 往来单位Treeview控件委托
        /// <summary>
        /// 物资操作回调事件
        /// </summary>
        public static event UpdateTreeViewDlgt SupplierUdTVEvnt;
        /// <summary>
        /// 物资操作回调处理事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="arg"></param>
        public static void OnSupplierUdTVEvnt(object sender, EventArgs arg)
        {
            if (SupplierUdTVEvnt != null)
                SupplierUdTVEvnt(sender, arg);
        }

        public static event UpdateTreeViewDlgt ClientUdTVEvnt;
        /// <summary>
        /// 物资操作回调处理事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="arg"></param>
        public static void OnClientUdTVEvnt(object sender, EventArgs arg)
        {
            if (ClientUdTVEvnt != null)
                ClientUdTVEvnt(sender, arg);
        }
        #endregion

        #region 质检选项Treeview控件委托
        /// <summary>
        /// 物资操作回调事件
        /// </summary>
        public static event UpdateTreeViewDlgt QcOptionUdTVEvnt;
        /// <summary>
        /// 物资操作回调处理事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="arg"></param>
        public static void OnQcOptionUdTVEvnt(object sender, EventArgs arg)
        {
            if (QcOptionUdTVEvnt != null)
                QcOptionUdTVEvnt(sender, arg);
        }
        #endregion

        #region 工序DataGridView控件委托
        public static event UpdateTreeViewDlgt WorkstageUdTVEvnt;
        public static void OnWorkstageUdTVEvnt(object sender, EventArgs arg)
        {
            if (WorkstageUdTVEvnt != null)
                WorkstageUdTVEvnt(sender, arg);
        }
        #endregion

        #region 部门Treeview控件委托
        /// <summary>
        /// 部门操作回调事件
        /// </summary>
        public static event UpdateTreeViewDlgt DeptUdTVEvnt;

        /// <summary>
        /// 部门操作回调处理事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="arg"></param>
        public static void OnDeptUdTVEvnt(object sender, EventArgs arg)
        {
            if (DeptUdTVEvnt != null)
                DeptUdTVEvnt(sender,arg);
        }
        #endregion

        #region 产品工程Treeview控件委托
        public static event UpdateTreeViewDlgt PrdtPrjtUdTVEvnt;

        /// <summary>
        /// 产品工程回调处理事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="arg"></param>
        public static void OnPrdtPrjtUdTVEvnt(object sender, EventArgs arg)
        {
            if (PrdtPrjtUdTVEvnt != null)
                PrdtPrjtUdTVEvnt(sender, arg);
        }
        #endregion

        #region 产品子工程Treeview控件委托
        public static event UpdateTreeViewDlgt SubPrdtPrjtUdTVEvnt;

        /// <summary>
        /// 产品子工程回调处理事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="arg"></param>
        public static void OnSubPrdtPrjtUdTVEvnt(object sender, EventArgs arg)
        {
            if (SubPrdtPrjtUdTVEvnt != null)
                SubPrdtPrjtUdTVEvnt(sender, arg);
        }
        #endregion

        #region 复制产品工程Treeview控件委托
        public static event UpdateTreeViewDlgt CopyPrjtUdTVEvnt;

        /// <summary>
        /// 复制产品工程回调处理事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="arg"></param>
        public static void OnCopyPrjtUdTVEvnt(object sender, EventArgs arg)
        {
            if (CopyPrjtUdTVEvnt != null)
                CopyPrjtUdTVEvnt(sender, arg);
        }
        #endregion

        #region 产品工程工序Treeview控件委托
        public static event UpdateTreeViewDlgt PrjtWorkstageUdTVEvnt;

        /// <summary>
        /// 产品工程工序回调处理事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="arg"></param>
        public static void OnPrjtWorkstageUdTVEvnt(object sender, EventArgs arg)
        {
            if (PrjtWorkstageUdTVEvnt != null)
                PrjtWorkstageUdTVEvnt(sender, arg);
        }
        #endregion

        #region 产品工程元件Treeview控件委托
        public static event UpdateTreeViewDlgt PrjtElementUdTVEvnt;

        /// <summary>
        /// 产品工程元件回调处理事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="arg"></param>
        public static void OnPrjtElementUdTVEvnt(object sender, EventArgs arg)
        {
            if (PrjtElementUdTVEvnt != null)
                PrjtElementUdTVEvnt(sender, arg);
        }
        #endregion

        /// <summary>
        /// 传递参数类
        /// </summary>
        public class NodeEventArgs : EventArgs
        {
            public NodeEventArgs(bool isNewNode, string key, string name, string value)
            {
                this.IsNewNode = isNewNode;
                this.Key = key;
                this.Name = name;
                this.Value = value;
            }
            public bool IsNewNode { get; set; }
            public string Key { get; set; }
            public string Name { get; set; }
            public string Value { get; set; }
        }
        #endregion

        #region 委托更新其它窗体DataGridView
        public delegate void UpdateDataGridViewDlgt(object sender, EventArgs arg);

        #region 物料DataGridView控件委托
        public static event UpdateDataGridViewDlgt MaterialUdDGVEvnt;
        public static void OnMaterialUdDGVEvnt(object sender, EventArgs arg)
        {
            if (MaterialUdDGVEvnt != null)
                MaterialUdDGVEvnt(sender, arg);
        }
        #endregion

        #region 搜索物料DataGridView控件委托
        public static event UpdateDataGridViewDlgt FindMaterialUdDGVEvnt;
        public static void OnFindMaterialUdDGVEvnt(object sender, EventArgs arg)
        {
            if (FindMaterialUdDGVEvnt != null)
                FindMaterialUdDGVEvnt(sender, arg);
        }
        #endregion

        #region 仓库DataGridView控件委托
        public static event UpdateDataGridViewDlgt DepotUdDGVEvnt;
        public static void OnDepotUdDGVEvnt(object sender, EventArgs arg)
        {
            if (DepotUdDGVEvnt != null)
                DepotUdDGVEvnt(sender, arg);
        }
        #endregion

        #region 往来单位DataGridView控件委托
        public static event UpdateDataGridViewDlgt SupplierUdDGVEvnt;
        public static void OnSupplierUdDGVEvnt(object sender, EventArgs arg)
        {
            if (SupplierUdDGVEvnt != null)
                SupplierUdDGVEvnt(sender, arg);
        }

        public static event UpdateDataGridViewDlgt ClientUdDGVEvnt;
        public static void OnClientUdDGVEvnt(object sender, EventArgs arg)
        {
            if (ClientUdDGVEvnt != null)
                ClientUdDGVEvnt(sender, arg);
        }
        #endregion

        #region 质检选项DataGridView控件委托
        public static event UpdateDataGridViewDlgt QcOptionUdDGVEvnt;
        public static void OnQcOptionUdDGVEvnt(object sender, EventArgs arg)
        {
            if (QcOptionUdDGVEvnt != null)
                QcOptionUdDGVEvnt(sender, arg);
        }
        #endregion

        #region 人员信息DataGridView控件委托
        public static event UpdateDataGridViewDlgt UserUdDGVEvnt;
        public static void OnUserUdDGVEvnt(object sender, EventArgs arg)
        {
            if (UserUdDGVEvnt != null)
                UserUdDGVEvnt(sender, arg);
        }
        #endregion

        #region 生产领料选择库存批号领料
        public static event UpdateDataGridViewDlgt SelectMaterialSpec;
        public static void OnSelectMaterialSpec(object sender, EventArgs arg)
        {
            if (SelectMaterialSpec != null)
                SelectMaterialSpec(sender, arg);
        }
        #endregion
        
        #endregion
    }
}
